﻿Imports System.ComponentModel

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class ucStudentMembershipDetails
    Inherits UcBaseEditControl
    Implements IUcEditControl

#Region "Designer"
    'UserControl overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    Public Sub New()

        ' This call is required by the designer.
        InitializeComponent()

        ' Add any initialization after the InitializeComponent() call.

    End Sub
    Friend WithEvents IsMemberlbl As System.Windows.Forms.Label
    Friend WithEvents IsMember As org.codegen.win.controls.CGCheckBox
    Friend WithEvents MemberNumberlbl As System.Windows.Forms.Label
    Friend WithEvents MemberNumber As org.codegen.win.controls.CGIntTextBox
    Friend WithEvents CountryIdlbl As System.Windows.Forms.Label
    Friend WithEvents CountryId As org.codegen.win.controls.CGComboBox
    Friend WithEvents LastPaymentDatelbl As System.Windows.Forms.Label
    Friend WithEvents LastPaymentDate As org.codegen.win.controls.CGDateTextBox
    Friend WithEvents LastSubscriptionYearlbl As System.Windows.Forms.Label
    Friend WithEvents LastSubscriptionYear As org.codegen.win.controls.CGIntTextBox
    Friend WithEvents MemberSincelbl As System.Windows.Forms.Label
    Friend WithEvents MemberSince As org.codegen.win.controls.CGDateTextBox
    Friend WithEvents IsMemberActivelbl As System.Windows.Forms.Label
    Friend WithEvents IsMemberActive As org.codegen.win.controls.CGCheckBox
    Friend WithEvents DistrictIdlbl As System.Windows.Forms.Label
	Friend WithEvents DistrictId As org.codegen.win.controls.CGComboBox
    Friend WithEvents btnChangeNumber As System.Windows.Forms.Button

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container()
        Me.IsMemberlbl = New System.Windows.Forms.Label()
        Me.IsMember = New org.codegen.win.controls.CGCheckBox(Me.components)
        Me.MemberNumberlbl = New System.Windows.Forms.Label()
        Me.MemberNumber = New org.codegen.win.controls.CGIntTextBox(Me.components)
        Me.CountryIdlbl = New System.Windows.Forms.Label()
        Me.CountryId = New org.codegen.win.controls.CGComboBox(Me.components)
        Me.LastPaymentDatelbl = New System.Windows.Forms.Label()
        Me.LastPaymentDate = New org.codegen.win.controls.CGDateTextBox(Me.components)
        Me.LastSubscriptionYearlbl = New System.Windows.Forms.Label()
        Me.LastSubscriptionYear = New org.codegen.win.controls.CGIntTextBox(Me.components)
        Me.MemberSincelbl = New System.Windows.Forms.Label()
        Me.MemberSince = New org.codegen.win.controls.CGDateTextBox(Me.components)
        Me.IsMemberActivelbl = New System.Windows.Forms.Label()
        Me.IsMemberActive = New org.codegen.win.controls.CGCheckBox(Me.components)
        Me.DistrictIdlbl = New System.Windows.Forms.Label()
        Me.DistrictId = New org.codegen.win.controls.CGComboBox(Me.components)
        Me.btnChangeNumber = New System.Windows.Forms.Button()
        CType(Me.ErrProvider, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        '
        'IsMemberlbl
        '
        Me.IsMemberlbl.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.IsMemberlbl.Location = New System.Drawing.Point(30, 4)
        Me.IsMemberlbl.Name = "IsMemberlbl"
        Me.IsMemberlbl.Size = New System.Drawing.Size(120, 20)
        Me.IsMemberlbl.TabIndex = 0
        Me.IsMemberlbl.Text = "Is Member"
        Me.IsMemberlbl.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'IsMember
        '
        Me.IsMember.AssociatedLabel = Me.IsMemberlbl
        Me.IsMember.BackColor = System.Drawing.Color.Transparent
        Me.IsMember.ErrProvider = Nothing
        Me.IsMember.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.IsMember.intValue = 0
        Me.IsMember.isMandatory = False
        Me.IsMember.Location = New System.Drawing.Point(156, 5)
        Me.IsMember.MaxValue = Nothing
        Me.IsMember.MinValue = Nothing
        Me.IsMember.Name = "IsMember"
        Me.IsMember.ReadOnly = False
        Me.IsMember.showAsteriskForMandatory = True
        Me.IsMember.Size = New System.Drawing.Size(15, 20)
        Me.IsMember.TabIndex = 1
        Me.IsMember.Text = "false"
        Me.IsMember.UseVisualStyleBackColor = False
        Me.IsMember.value = False
        '
        'MemberNumberlbl
        '
        Me.MemberNumberlbl.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.MemberNumberlbl.Location = New System.Drawing.Point(7, 30)
        Me.MemberNumberlbl.Name = "MemberNumberlbl"
        Me.MemberNumberlbl.Size = New System.Drawing.Size(142, 20)
        Me.MemberNumberlbl.TabIndex = 4
        Me.MemberNumberlbl.Text = "Member Number"
        Me.MemberNumberlbl.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'MemberNumber
        '
        Me.MemberNumber.AssociatedLabel = Me.MemberNumberlbl
        Me.MemberNumber.BackColor = System.Drawing.SystemColors.ButtonFace
        Me.MemberNumber.ErrProvider = Nothing
        Me.MemberNumber.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.MemberNumber.FormatPattern = Nothing
        Me.MemberNumber.isMandatory = False
        Me.MemberNumber.Location = New System.Drawing.Point(156, 30)
        Me.MemberNumber.MaxLength = 255
        Me.MemberNumber.MaxValue = Nothing
        Me.MemberNumber.MinValue = Nothing
        Me.MemberNumber.Name = "MemberNumber"
        Me.MemberNumber.ReadOnly = True
        Me.MemberNumber.showAsteriskForMandatory = True
        Me.MemberNumber.Size = New System.Drawing.Size(200, 21)
        Me.MemberNumber.TabIndex = 5
        '
        'CountryIdlbl
        '
        Me.CountryIdlbl.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.CountryIdlbl.Location = New System.Drawing.Point(7, 166)
        Me.CountryIdlbl.Name = "CountryIdlbl"
        Me.CountryIdlbl.Size = New System.Drawing.Size(142, 20)
        Me.CountryIdlbl.TabIndex = 15
        Me.CountryIdlbl.Text = "Country"
        Me.CountryIdlbl.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'CountryId
        '
        Me.CountryId.AssociatedLabel = Me.CountryIdlbl
        Me.CountryId.BackColor = System.Drawing.Color.Transparent
        Me.CountryId.ErrProvider = Nothing
        Me.CountryId.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.CountryId.isMandatory = False
        Me.CountryId.Location = New System.Drawing.Point(156, 166)
        Me.CountryId.MaxLength = 255
        Me.CountryId.MaxValue = Nothing
        Me.CountryId.MinValue = Nothing
        Me.CountryId.Name = "CountryId"
        Me.CountryId.showAsteriskForMandatory = True
        Me.CountryId.Size = New System.Drawing.Size(200, 21)
        Me.CountryId.TabIndex = 16
        '
        'LastPaymentDatelbl
        '
        Me.LastPaymentDatelbl.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.LastPaymentDatelbl.Location = New System.Drawing.Point(7, 57)
        Me.LastPaymentDatelbl.Name = "LastPaymentDatelbl"
        Me.LastPaymentDatelbl.Size = New System.Drawing.Size(142, 20)
        Me.LastPaymentDatelbl.TabIndex = 7
        Me.LastPaymentDatelbl.Text = "Last Payment Date"
        Me.LastPaymentDatelbl.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'LastPaymentDate
        '
        Me.LastPaymentDate.AssociatedLabel = Me.LastPaymentDatelbl
        Me.LastPaymentDate.BackColor = System.Drawing.Color.Transparent
        Me.LastPaymentDate.ErrProvider = Nothing
        Me.LastPaymentDate.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.LastPaymentDate.isMandatory = False
        Me.LastPaymentDate.Location = New System.Drawing.Point(156, 57)
        Me.LastPaymentDate.MaxLength = 255
        Me.LastPaymentDate.MaxValue = Nothing
        Me.LastPaymentDate.MinValue = Nothing
        Me.LastPaymentDate.Name = "LastPaymentDate"
        Me.LastPaymentDate.showAsteriskForMandatory = True
        Me.LastPaymentDate.Size = New System.Drawing.Size(200, 21)
        Me.LastPaymentDate.TabIndex = 8
        '
        'LastSubscriptionYearlbl
        '
        Me.LastSubscriptionYearlbl.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.LastSubscriptionYearlbl.Location = New System.Drawing.Point(7, 85)
        Me.LastSubscriptionYearlbl.Name = "LastSubscriptionYearlbl"
        Me.LastSubscriptionYearlbl.Size = New System.Drawing.Size(142, 20)
        Me.LastSubscriptionYearlbl.TabIndex = 9
        Me.LastSubscriptionYearlbl.Text = "Last Subscription Year"
        Me.LastSubscriptionYearlbl.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'LastSubscriptionYear
        '
        Me.LastSubscriptionYear.AssociatedLabel = Me.LastSubscriptionYearlbl
        Me.LastSubscriptionYear.BackColor = System.Drawing.Color.Transparent
        Me.LastSubscriptionYear.ErrProvider = Nothing
        Me.LastSubscriptionYear.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.LastSubscriptionYear.FormatPattern = Nothing
        Me.LastSubscriptionYear.isMandatory = False
        Me.LastSubscriptionYear.Location = New System.Drawing.Point(156, 85)
        Me.LastSubscriptionYear.MaxLength = 255
        Me.LastSubscriptionYear.MaxValue = Nothing
        Me.LastSubscriptionYear.MinValue = Nothing
        Me.LastSubscriptionYear.Name = "LastSubscriptionYear"
        Me.LastSubscriptionYear.showAsteriskForMandatory = True
        Me.LastSubscriptionYear.Size = New System.Drawing.Size(200, 21)
        Me.LastSubscriptionYear.TabIndex = 10
        '
        'MemberSincelbl
        '
        Me.MemberSincelbl.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.MemberSincelbl.Location = New System.Drawing.Point(7, 112)
        Me.MemberSincelbl.Name = "MemberSincelbl"
        Me.MemberSincelbl.Size = New System.Drawing.Size(142, 20)
        Me.MemberSincelbl.TabIndex = 11
        Me.MemberSincelbl.Text = "Member Since"
        Me.MemberSincelbl.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'MemberSince
        '
        Me.MemberSince.AssociatedLabel = Me.MemberSincelbl
        Me.MemberSince.BackColor = System.Drawing.Color.Transparent
        Me.MemberSince.ErrProvider = Nothing
        Me.MemberSince.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.MemberSince.isMandatory = False
        Me.MemberSince.Location = New System.Drawing.Point(156, 112)
        Me.MemberSince.MaxLength = 255
        Me.MemberSince.MaxValue = Nothing
        Me.MemberSince.MinValue = Nothing
        Me.MemberSince.Name = "MemberSince"
        Me.MemberSince.showAsteriskForMandatory = True
        Me.MemberSince.Size = New System.Drawing.Size(200, 21)
        Me.MemberSince.TabIndex = 12
        '
        'IsMemberActivelbl
        '
        Me.IsMemberActivelbl.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.IsMemberActivelbl.Location = New System.Drawing.Point(199, 4)
        Me.IsMemberActivelbl.Name = "IsMemberActivelbl"
        Me.IsMemberActivelbl.Size = New System.Drawing.Size(142, 20)
        Me.IsMemberActivelbl.TabIndex = 2
        Me.IsMemberActivelbl.Text = "Is Member Active"
        Me.IsMemberActivelbl.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'IsMemberActive
        '
        Me.IsMemberActive.AssociatedLabel = Me.IsMemberActivelbl
        Me.IsMemberActive.BackColor = System.Drawing.Color.Transparent
        Me.IsMemberActive.ErrProvider = Nothing
        Me.IsMemberActive.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.IsMemberActive.intValue = 0
        Me.IsMemberActive.isMandatory = False
        Me.IsMemberActive.Location = New System.Drawing.Point(347, 5)
        Me.IsMemberActive.MaxValue = Nothing
        Me.IsMemberActive.MinValue = Nothing
        Me.IsMemberActive.Name = "IsMemberActive"
        Me.IsMemberActive.ReadOnly = False
        Me.IsMemberActive.showAsteriskForMandatory = True
        Me.IsMemberActive.Size = New System.Drawing.Size(15, 20)
        Me.IsMemberActive.TabIndex = 3
        Me.IsMemberActive.Text = "false"
        Me.IsMemberActive.UseVisualStyleBackColor = False
        Me.IsMemberActive.value = False
        '
        'DistrictIdlbl
        '
        Me.DistrictIdlbl.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.DistrictIdlbl.Location = New System.Drawing.Point(7, 139)
        Me.DistrictIdlbl.Name = "DistrictIdlbl"
        Me.DistrictIdlbl.Size = New System.Drawing.Size(142, 20)
        Me.DistrictIdlbl.TabIndex = 13
        Me.DistrictIdlbl.Text = "District"
        Me.DistrictIdlbl.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'DistrictId
        '
        Me.DistrictId.AssociatedLabel = Me.DistrictIdlbl
        Me.DistrictId.BackColor = System.Drawing.Color.Transparent
        Me.DistrictId.ErrProvider = Nothing
        Me.DistrictId.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.DistrictId.isMandatory = False
        Me.DistrictId.Location = New System.Drawing.Point(156, 139)
        Me.DistrictId.MaxLength = 255
        Me.DistrictId.MaxValue = Nothing
        Me.DistrictId.MinValue = Nothing
        Me.DistrictId.Name = "DistrictId"
        Me.DistrictId.showAsteriskForMandatory = True
        Me.DistrictId.Size = New System.Drawing.Size(200, 21)
        Me.DistrictId.TabIndex = 14
        '
        'btnChangeNumber
        '
        Me.btnChangeNumber.Location = New System.Drawing.Point(362, 28)
        Me.btnChangeNumber.Name = "btnChangeNumber"
        Me.btnChangeNumber.Size = New System.Drawing.Size(67, 23)
        Me.btnChangeNumber.TabIndex = 6
        Me.btnChangeNumber.Text = "Change..."
        Me.btnChangeNumber.UseVisualStyleBackColor = True
        '
        'ucStudentMembershipDetails
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.AutoValidate = System.Windows.Forms.AutoValidate.EnableAllowFocusChange
        Me.Controls.Add(Me.btnChangeNumber)
        Me.Controls.Add(Me.MemberNumber)
        Me.Controls.Add(Me.IsMemberlbl)
        Me.Controls.Add(Me.IsMember)
        Me.Controls.Add(Me.MemberNumberlbl)
        Me.Controls.Add(Me.CountryIdlbl)
        Me.Controls.Add(Me.CountryId)
        Me.Controls.Add(Me.LastPaymentDatelbl)
        Me.Controls.Add(Me.LastPaymentDate)
        Me.Controls.Add(Me.LastSubscriptionYearlbl)
        Me.Controls.Add(Me.LastSubscriptionYear)
        Me.Controls.Add(Me.MemberSincelbl)
        Me.Controls.Add(Me.MemberSince)
        Me.Controls.Add(Me.IsMemberActivelbl)
        Me.Controls.Add(Me.IsMemberActive)
        Me.Controls.Add(Me.DistrictIdlbl)
        Me.Controls.Add(Me.DistrictId)
        Me.Name = "ucStudentMembershipDetails"
        Me.Size = New System.Drawing.Size(480, 204)
        CType(Me.ErrProvider, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub





#End Region

#Region "Properties"


#End Region

#Region "Methods"

    ''' <summary>
    ''' This flag keeps the membership status of the person 
    ''' when the record is loaded on screen
    ''' </summary>
    Private isMemberOnLoad As Boolean

    ''' <summary>
    ''' Keep the member number on load of page.
    ''' To confirm member number changes
    ''' </summary>
    Private MemberNoOnLoad As Integer?

    ''' <summary>
    ''' Fills the controls on the screen from data in the object
    ''' </summary>
    ''' <remarks></remarks>
    Public Sub _loadData() Handles Me.evLoadObjectData

        If (Not Me.MemberNoOnLoad Is Nothing) AndAlso _
                Me.MemberNoOnLoad.GetValueOrDefault <> Me.MemberNumber.integerValue.GetValueOrDefault Then

            Dim msg As String = String.Format("*** WARNING: Member Number has changed From {0} to {1}! Do you want to Continue?", Me.MemberNoOnLoad, Me.MemberNumber.Text)
            Dim v As MsgBoxResult = MsgBox(msg, _
                 CType(MsgBoxStyle.Question + MsgBoxStyle.YesNo, MsgBoxStyle))

            If v = MsgBoxResult.No Then Exit Sub

        End If

        Dim mo As Student = DirectCast(Me.ModelObject(), Student)
        Me.IsMember.value = mo.IsMember
        Me.MemberNumber.value = mo.MemberNumber
        Me.CountryId.Value = mo.CountryId
        Me.LastPaymentDate.value = mo.LastPaymentDate
        Me.LastSubscriptionYear.value = mo.LastSubscriptionYear
        Me.MemberSince.value = mo.MemberSince
        Me.IsMemberActive.value = mo.IsMemberActive
        Me.DistrictId.Value = mo.DistrictId

        Me.isMemberOnLoad = mo.IsMember.Value
        Me.MemberNoOnLoad = mo.MemberNumber

        Me.MemberNumber.Enabled = False

        Me.SetMembershipFields()
        Me.btnChangeNumber.Visible = Me.MemberNumber.Text <> ""

    End Sub

    ''' <summary>
    ''' Loads the object from the database and then sets the proeperties 
    ''' of the object from values on the controls
    ''' </summary>
    ''' <remarks></remarks>
    Public Sub _loadToObject() Handles Me.evLoadToObject

        Dim mo As Student = DirectCast(Me.ModelObject, Student)
        mo.setIsMember(Me.IsMember.Text)
        mo.CountryId = Me.CountryId.intValue
        mo.setLastPaymentDate(Me.LastPaymentDate.Text)
        mo.setLastSubscriptionYear(Me.LastSubscriptionYear.Text)
        mo.setMemberSince(Me.MemberSince.Text)
        'mo.setIsMemberActive(IIf(Me.IsMemberActive.value, 1, 0))
        If CBool(Me.IsMemberActive.value) Then
            mo.setIsMemberActive("1")
        Else
            mo.setIsMemberActive("0")
        End If

        mo.DistrictId = Me.DistrictId.intValue
        mo.setMemberNumber(Me.MemberNumber.Text)

    End Sub

    Public Sub _InitializeControl() Handles Me.InitializeControl

        If Me.isInitialized = False Then
            'setup datasources here
            Me.CountryId.DataSource = New BusObjects.Mappers.CountryDBMapper().findAll()
            Me.CountryId.DisplayMember = "CountryName"
            Me.CountryId.ValueMember = "CountryId"
            Me.DistrictId.DataSource = New BusObjects.Mappers.DistrictDBMapper().findAll()
            Me.DistrictId.DisplayMember = "DistrictName"
            Me.DistrictId.ValueMember = "DistrictId"

            Me.isInitialized = True
        End If

    End Sub

#End Region


    Private Sub IsMember_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) _
      Handles IsMember.CheckedChanged

        Me.SetMembershipFields()

    End Sub

    Private Sub SetMembershipFields()

        'set membership Fields
        Dim needToGenerateNumber As Boolean = (Me.isMemberOnLoad = False) AndAlso _
                        Me.IsMember.Checked AndAlso _
                        String.IsNullOrEmpty(Me.MemberNumber.Text)

        
        If needToGenerateNumber Then
            Me.IsMemberActive.Checked = True
        End If

        If Me.IsMember.Checked = False Then
            Me.IsMemberActive.Checked = False
            Me.IsMemberActive.Enabled = False
        Else
            Me.IsMemberActive.Enabled = True
        End If

    End Sub

    Private Sub btnChangeNumber_Click(ByVal sender As System.Object, _
                                      ByVal e As System.EventArgs) _
                    Handles btnChangeNumber.Click

        Dim x As String = InputBox("Enter New Member Number", "Change Member Number", Me.MemberNumber.Text)
        Dim newNumber As Integer
        If Integer.TryParse(x, newNumber) = True Then
            Me.MemberNumber.Text = CStr(newNumber)
        Else
            MsgBox("New Member Number must be an Integer ", MsgBoxStyle.Exclamation, FormsApplicationContext.current.ApplicationTitle)

        End If

    End Sub

   Function memberNumberChanged() As Boolean
        Return (Me.MemberNoOnLoad.GetValueOrDefault > 0) AndAlso _
                            Me.MemberNoOnLoad.GetValueOrDefault <> Me.MemberNumber.integerValue.GetValueOrDefault

    End Function

    
    Private Sub ucStudentMembershipDetails_Validating(ByVal sender As Object, _
                        ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.Validating

        If (Me.memberNumberChanged()) Then

            Dim msg As String = String.Format("*** WARNING: Member Number has changed From {0} to {1}! Do you want to Continue?", Me.MemberNoOnLoad, Me.MemberNumber.Text)
            Dim v As MsgBoxResult = MsgBox(msg, _
                 CType(MsgBoxStyle.Question + MsgBoxStyle.YesNo, MsgBoxStyle))

            If v = MsgBoxResult.No Then e.Cancel = True

        End If

    End Sub
End Class


